package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.MaterialOrderMapper;
import com.ruoyi.system.api.domain.MaterialOrder;
import com.ruoyi.system.service.IMaterialOrderService;

/**
 * 购买记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-12-04
 */
@Service
public class MaterialOrderServiceImpl implements IMaterialOrderService 
{
    @Autowired
    private MaterialOrderMapper materialOrderMapper;

    /**
     * 查询购买记录
     * 
     * @param id 购买记录主键
     * @return 购买记录
     */
    @Override
    public MaterialOrder selectMaterialOrderById(Long id)
    {
        return materialOrderMapper.selectMaterialOrderById(id);
    }

    /**
     * 查询购买记录列表
     * 
     * @param materialOrder 购买记录
     * @return 购买记录
     */
    @Override
    public List<MaterialOrder> selectMaterialOrderList(MaterialOrder materialOrder)
    {
        return materialOrderMapper.selectMaterialOrderList(materialOrder);
    }

    /**
     * 新增购买记录
     * 
     * @param materialOrder 购买记录
     * @return 结果
     */
    @Override
    public int insertMaterialOrder(MaterialOrder materialOrder)
    {
        materialOrder.setCreateTime(DateUtils.getNowDate());
        return materialOrderMapper.insertMaterialOrder(materialOrder);
    }

    /**
     * 修改购买记录
     * 
     * @param materialOrder 购买记录
     * @return 结果
     */
    @Override
    public int updateMaterialOrder(MaterialOrder materialOrder)
    {
        return materialOrderMapper.updateMaterialOrder(materialOrder);
    }

    /**
     * 批量删除购买记录
     * 
     * @param ids 需要删除的购买记录主键
     * @return 结果
     */
    @Override
    public int deleteMaterialOrderByIds(Long[] ids)
    {
        return materialOrderMapper.deleteMaterialOrderByIds(ids);
    }

    /**
     * 删除购买记录信息
     * 
     * @param id 购买记录主键
     * @return 结果
     */
    @Override
    public int deleteMaterialOrderById(Long id)
    {
        return materialOrderMapper.deleteMaterialOrderById(id);
    }
}
